/**
 * Created by Administrator on 2017/5/3.
 */
$(document).ready(function () {
    $(this).keyup(function (e) {
        var firstpelem = $('p:first');
        switch (e.keyCode) {
            case 37:
                firstpelem.animate({ marginLeft: '+=20px' }, 'slow');
                break;
            case 38:
                firstpelem.animate({ marginTop: '+=20px' }, 'slow');
                break;
            case 39:
                firstpelem.animate({ marginRight: '+=20px' }, 'slow');
                break;
            case 40:
                firstpelem.animate({ marginBottom: '+=20px' }, 'slow');
                break;
        }
    });
});